<?php

namespace app\controllers;

use app\models\Project;
use Yii;
use yii\helpers\Url;

class UcenterController extends BasisController
{
    public function actionIndex()
    {
        $uid = Yii::$app->user->id;
        isset($uid) && !empty($uid) && $where['created_uid'] = $uid;

        $where['is_del'] = 0;
        $where['is_public'] = 1;

        $projects = Project::getAllProjects($where,'created_time desc',false);
        return $this->render('index',compact('projects'));
    }


    #�?出登�?
    public function actionLogout()
    {
        Yii::$app->user->logout();
        return $this->redirect(Url::toRoute('/auth/login'));
    }
}
